<% content_for :heading do %>
  <h2><%= t 'trace.view.heading', :name => h(@trace.name) %></h2>
<% end %>

<% if STATUS != :gpx_offline %>
  <% if @trace.inserted %>
    <img src="<%= url_for :controller => 'trace', :action => 'picture', :id => @trace.id, :display_name => @trace.user.display_name %>">
  <% else %>
    <span style="color:red"><%= t'trace.view.pending' %></span>
  <% end %>
<% end %>

<table border="0">
  <tr>
    <td><%= t'trace.view.filename' %></td>
    <td><%= @trace.name %> (<%= link_to t('trace.view.download'), :controller => 'trace', :action => 'data', :id => @trace.id %>)</td>
  </tr>
  <tr>
    <td><%= t'trace.view.uploaded' %></td>
    <td><%= l @trace.timestamp, :format => :friendly %></td>
  </tr>
  <% if @trace.inserted? %>
  <tr>
    <td><%= t'trace.view.points' %></td>
    <td><%= @trace.size.to_s.gsub(/(\d)(?=(\d{3})+$)/,'\1,') %></td></tr>
  <tr>
    <td><%= t'trace.view.start_coordinates' %></td>
    <td><div class="geo" style="display: inline"><span class="latitude"><%= @trace.latitude %></span>; <span class="longitude"><%= @trace.longitude %></span></div> (<%=link_to t('trace.view.map'), :controller => 'site', :action => 'index', :anchor => "map=14/#{@trace.latitude}/#{@trace.longitude}" %> / <%=link_to t('trace.view.edit'), :controller => 'site', :action => 'edit', :gpx=> @trace.id, :anchor => "map=14/#{@trace.latitude}/#{@trace.longitude}" %>)</td>
  </tr>
  <% end %>
  <tr>
    <td><%= t'trace.view.owner' %></td>
    <td><%= link_to h(@trace.user.display_name), {:controller => 'user', :action => 'view', :display_name => @trace.user.display_name} %></td>
  </tr>
  <tr>
    <td><%= t'trace.view.description' %></td>
    <td><%= h(@trace.description) %></td>
  </tr>
  <tr>
    <td><%= t'trace.view.tags' %></td>
    <td>
    <% unless @trace.tags.empty? %>
      <%= raw(@trace.tags.collect { |tag| link_to tag.tag, { :controller => 'trace', :action => 'list', :tag => tag.tag, :id => nil } }.join(", ")) %>
    <% else %>
      <i><%= t'trace.view.none' %></i>
    <% end %>
    </td>
  </tr>
  <tr>
    <td><%= t'trace.view.visibility' %></td>
    <td><%= t"trace.visibility.#{@trace.visibility}" %></td>
  </tr>
</table>

<br /><br />

<%= if_user(@trace.user) do %>
  <div class="buttons">
    <%= button_to t('trace.view.edit_track'), :controller => 'trace', :action => 'edit', :id => @trace.id %>
    <%= button_to t('trace.view.delete_track'), :controller => 'trace', :action => 'delete', :id => @trace.id %>
  </div>
<% end %>
